package com.atguigu.eduService.service.impl;

import com.atguigu.eduService.entity.EduComment;
import com.atguigu.eduService.mapper.EduCommentMapper;
import com.atguigu.eduService.service.EduCommentService;
import com.atguigu.eduService.utils.PageUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 评论 服务实现类
 * </p>
 *
 * @author smday
 * @since 2020-08-01
 */
@Service
public class EduCommentServiceImpl extends ServiceImpl<EduCommentMapper, EduComment> implements EduCommentService {


    @Override
    public Map<String, Object> getCommentPage(Page<EduComment> page, String courseId) {

        QueryWrapper<EduComment> wrapper = new QueryWrapper<>();
        wrapper.eq("course_id",courseId);
        baseMapper.selectPage(page, wrapper);
        return PageUtils.convertPageToMap(page);

    }
}
